package dk.hojlind.hackhunt.control;

import dk.hojlind.hackhunt.model.ClientSocket;

public class LogHandler extends Handler{
	
	//Public variables
	
	//Private variables
	
	//Constructor
	public LogHandler(String adress, int port) {
		super(adress, port);
		
	}
	
	public String logIn(String nick, String pass, String ipAddress)
	{
		if(check(nick) == false)
			return error;
		
		if(check(pass) == false)
			return error;
		
		String message = "login" + ";" + nick + ";" + pass + ";" + ipAddress;
		socket = new ClientSocket(adress, port);
		result = socket.processRequest(message);
		return result;
	}
	
	public String logOut(String nick, String pass)
	{
		if(check(nick) == false)
			return error;
		
		if(check(pass) == false)
			return error;
		
		String message = "logout" + ";" + nick + ";" + pass;
		socket = new ClientSocket(adress, port);
		result = socket.processRequest(message);
		return result;
	}
	
}
